/**
 * deps 比较算法
 */

/**
 *
 * @param {Array} nextDeps 当前依赖数组
 * @param {Array} prevDeps 上一次依赖数组
 * @returns {Boolean} 新旧依赖数组是否equal
 */

function objectIs(prevDeps, nextDeps) {
    return typeof prevDeps === 'object' && typeof nextDeps === 'object'
}
function areHookInputsEqual(nextDeps, prevDeps) {
    {
        if (false) {
            // Only true when this component is being hot reloaded.
            return false;
        }
    }

    if (prevDeps === null) {
        {
            error('%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
        }

        return false;
    }

    {
        // Don't bother comparing lengths in prod because these arrays should be
        // passed inline.
        if (nextDeps.length !== prevDeps.length) {
            error('The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, "[" + prevDeps.join(', ') + "]", "[" + nextDeps.join(', ') + "]");
        }
    }

    for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
        if (objectIs(nextDeps[i], prevDeps[i])) {
            continue;
        }

        return false;
    }

    return true;
}


const res1 = areHookInputsEqual([1, 2, 3, 4], [1, 2, 3, 4])
const res2 = areHookInputsEqual([{ a: 1 }], [{ a: 1 }])
console.log(res1);
console.log(res2);
console.log(res2);